90507: Function test for xfi:concept-relationships

Documentation

Tests of function xfi:concept-relationships($source as xs:QName, $linkrole as xs:string?, $arcrole as xs:string, $axis as xs:string, $generations as xs:integer, $xbrlinstance as element(xbrli:xbrl)) as element(xl:arc)* Please see the examples and formula-testcase-based variations in the companion file, which is in the formula testcase format, 61100 ConceptRelationsFilter-Processing.xml

Owners

Name Affiliation Email Start End
Herm Fischer UBMatrix / Mark V Systems fischer@markv.com 12-12-2008 at 00:00:00
Andy Harris UBMatrix andy.harris@ubmatrix.com 12-09-2010 at 01:07:00
Peter Cowan CoreFiling prc@corefiling.com 29-11-2012 at 17:41:00
Richard Ashby CoreFiling rna@corefiling.com 10-01-2014 at 15:00:00

References

http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670666

Test Case Variations


V-01 Presentation descendants, link1, top level, 1 generation

Documentation

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V01)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A'), 'http://abc.com/role/link1', 'http://www.xbrl.org/2003/arcrole/parent-child', 'descendant', xs:nonNegativeInteger(1))

    (against file V01)

Outputs

  • Result test: count($result) eq 3 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","presentationArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A1") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A2") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","A3")

V-02 Presentation descendants, concept not in network

Documentation

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V02)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','B'), 'http://abc.com/role/link1', 'http://www.xbrl.org/2003/arcrole/parent-child', 'descendant', xs:nonNegativeInteger(1))

    (against file V02)

Outputs

  • Result test: empty($result)

V-03 Presentation descendants, concept a leaf node

Documentation

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V03)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A111'), 'http://abc.com/role/link1', 'http://www.xbrl.org/2003/arcrole/parent-child', 'descendant', xs:nonNegativeInteger(1))

    (against file V03)

Outputs

  • Result test: empty($result)

V-04 Presentation ancestors, 3 generations

Documentation

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V04)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A111'), 'http://abc.com/role/link1', 'http://www.xbrl.org/2003/arcrole/parent-child', 'ancestor', xs:nonNegativeInteger(3))

    (against file V04)

Outputs

  • Result test: count($result) eq 3 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","presentationArc")) and xfi:relationship-from-concept($result[1]) eq QName("http://abc.com/test","A11") and xfi:relationship-from-concept($result[2]) eq QName("http://abc.com/test","A1") and xfi:relationship-from-concept($result[3]) eq QName("http://abc.com/test","A")

V-05 Presentation ancestors, 4 generations

Documentation

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V05)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A111'), 'http://abc.com/role/link1', 'http://www.xbrl.org/2003/arcrole/parent-child', 'ancestor', xs:nonNegativeInteger(4))

    (against file V05)

Outputs

  • Result test: count($result) eq 3 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","presentationArc")) and xfi:relationship-from-concept($result[1]) eq QName("http://abc.com/test","A11") and xfi:relationship-from-concept($result[2]) eq QName("http://abc.com/test","A1") and xfi:relationship-from-concept($result[3]) eq QName("http://abc.com/test","A")

V-06 Presentation siblings

Documentation

This case has the siblings of non-root concepts (mid-tree).

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V06)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A13'), 'http://abc.com/role/link1', 'http://www.xbrl.org/2003/arcrole/parent-child', 'sibling', xs:nonNegativeInteger(1))

    (against file V06)

Outputs

  • Result test: count($result) eq 2 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","presentationArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A11") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A12")

V-06a Presentation siblings (at root) link 1

Documentation

This case requests the siblings of a root concept, but root concept has no parent relationships and thus siblings is always an empty sequence (see the function's description of sibling axis).

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V06a)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A'), 'http://abc.com/role/link1', 'http://www.xbrl.org/2003/arcrole/parent-child', 'sibling', xs:nonNegativeInteger(1))

    (against file V06a)

Outputs

  • Result test: empty($result)

V-06b Presentation siblings for (at root) link 2

Documentation

Same as V-06a but for link2. Concept B in link2 has a "companion" root element C, but C is not a sibling because B and C don't share a parent, so the list of siblings is empty.

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V06b)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','B'), 'http://abc.com/role/link2', 'http://www.xbrl.org/2003/arcrole/parent-child', 'sibling', xs:nonNegativeInteger(1))

    (against file V06b)

Outputs

  • Result test: empty($result)

V-06c Presentation siblings (leaf node)

Documentation

Same as V-06a but for a leaf node (tree-bottom).

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V06c)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','B1'), 'http://abc.com/role/link2', 'http://www.xbrl.org/2003/arcrole/parent-child', 'sibling', xs:nonNegativeInteger(1))

    (against file V06c)

Outputs

  • Result test: count($result) eq 1 and xfi:relationship-to-concept($result) eq QName("http://abc.com/test","A2")

V-07 Presentation siblings

Documentation

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V07)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A12'), 'http://abc.com/role/link1', 'http://www.xbrl.org/2003/arcrole/parent-child', 'sibling', xs:nonNegativeInteger(1))

    (against file V07)

Outputs

  • Result test: count($result) eq 2 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","presentationArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A11") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A13")

V-07a Presentation siblings (at root) link1

Documentation

Same as V-06a but for siblings at root. As no parent relationships exist there cannot be any sibling result.

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V07a)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','B'), 'http://abc.com/role/link2', 'http://www.xbrl.org/2003/arcrole/parent-child', 'sibling', xs:nonNegativeInteger(1))

    (against file V07a)

Outputs

  • Result test: empty($result)

V-08 Presentation full treewalk from root, all generations

Documentation

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V08)
  • Function Call: xfi:concept-relationships( QName('http://www.xbrl.org/2008/function/instance','root'), 'http://abc.com/role/link2', 'http://www.xbrl.org/2003/arcrole/parent-child', 'descendant', xs:nonNegativeInteger(0))

    (against file V08)

Outputs

  • Result test: count($result) eq 4 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","presentationArc")) and (xfi:relationship-from-concept($result[1]) eq QName("http://abc.com/test","B") and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","B1") and xfi:relationship-from-concept($result[2]) eq QName("http://abc.com/test","B") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A2") and xfi:relationship-from-concept($result[3]) eq QName("http://abc.com/test","C") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","C1") and xfi:relationship-from-concept($result[4]) eq QName("http://abc.com/test","C1") and xfi:relationship-to-concept($result[4]) eq QName("http://abc.com/test","A3")) or (xfi:relationship-from-concept($result[1]) eq QName("http://abc.com/test","C") and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","C1") and xfi:relationship-from-concept($result[2]) eq QName("http://abc.com/test","C1") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A3") and xfi:relationship-from-concept($result[3]) eq QName("http://abc.com/test","B") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","B1") and xfi:relationship-from-concept($result[4]) eq QName("http://abc.com/test","B") and xfi:relationship-to-concept($result[4]) eq QName("http://abc.com/test","A2"))

V-09 Definition custom arc treewalk with loop, unlimited generations

Documentation

Demonstrates that when a descendant (or ancestor) concept repeats in the path from the source, it is not navigated further for unlimited generations navigation (generations=0). Here navigation starts at A1, for descendants for unlimited generations. In this case A1 is not included first in the output but A1 is a descendant of A13 (A1->A13->A1) so the A1 occurence under A13 is included in the output, but no further navigation from the repeat (directed cycle) beneath A1 is navigated. (For debugging see V-09a to V-09d.)

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V09)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A1'), 'http://abc.com/role/link1', 'http://abc.com/arcrole/def-test', 'descendant', xs:nonNegativeInteger(0))

    (against file V09)

Outputs

  • Result test: count($result) eq 9 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","definitionArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A11") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A111") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","A112") and xfi:relationship-to-concept($result[4]) eq QName("http://abc.com/test","A113") and xfi:relationship-to-concept($result[5]) eq QName("http://abc.com/test","A12") and xfi:relationship-to-concept($result[6]) eq QName("http://abc.com/test","A121") and xfi:relationship-to-concept($result[7]) eq QName("http://abc.com/test","A122") and xfi:relationship-to-concept($result[8]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[9]) eq QName("http://abc.com/test","A1")

V-09a Definition custom arc treewalk with loop, link2, unlimited generations

Documentation

Based on V-09 but using link2 (which has no A11 or A12 subtrees, for easier tracing and debugging). Here for unlimited generations. Should result in A1->A13->A1, but only provide A13 and A1 in output sequence.

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V09a)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A1'), 'http://abc.com/role/link2', 'http://abc.com/arcrole/def-test', 'descendant', xs:nonNegativeInteger(0))

    (against file V09a)

Outputs

  • Result test: count($result) eq 2 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","definitionArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A1")

V-09b Definition custom arc treewalk with loop, link2, unlimited generations

Documentation

Here for unlimited generations, with '-or-self'. Should result in A1->A13->A1, and include A1, A13 and A1 in output sequence (representing order of tree walking including self, the first A1).

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V09b)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A1'), 'http://abc.com/role/link2', 'http://abc.com/arcrole/def-test', 'descendant', xs:nonNegativeInteger(0))

    (against file V09b)

Outputs

  • Result test: count($result) eq 2 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","definitionArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A1")

V-09c Definition custom arc treewalk with loop, link2, 7 generations

Documentation

Specified depth of tree walk generations, including recursion. Demonstrates that when a descendant (or ancestor) concept repeats in the path from the source, for a specified generation count the directed cycle continues to be navigated. Here navigation starts at A1, for descendants (not self) for 7 generations. In this case A1 is not included first in the output but A1 is a descendant of A13 (A1->A13->A1), so the actual result shows A13->A1->A13->A1->A13->A1->A13.

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V09c)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A1'), 'http://abc.com/role/link2', 'http://abc.com/arcrole/def-test', 'descendant', xs:nonNegativeInteger(7))

    (against file V09c)

Outputs

  • Result test: count($result) eq 7 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","definitionArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A1") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[4]) eq QName("http://abc.com/test","A1") and xfi:relationship-to-concept($result[5]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[6]) eq QName("http://abc.com/test","A1") and xfi:relationship-to-concept($result[7]) eq QName("http://abc.com/test","A13")

V-09d Definition custom arc treewalk with loop, link2, 7 generations

Documentation

Specified depth of tree walk generations, including recursion.

Inputs

  • schema: nav-rel-test1.xsd (DTS Discovery starting point) (ID=V09d)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A1'), 'http://abc.com/role/link2', 'http://abc.com/arcrole/def-test', 'descendant', xs:nonNegativeInteger(7))

    (against file V09d)

Outputs

  • Result test: count($result) eq 7 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","definitionArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A1") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[4]) eq QName("http://abc.com/test","A1") and xfi:relationship-to-concept($result[5]) eq QName("http://abc.com/test","A13") and xfi:relationship-to-concept($result[6]) eq QName("http://abc.com/test","A1") and xfi:relationship-to-concept($result[7]) eq QName("http://abc.com/test","A13")

V-10 Calculation relations with weights, default link

Documentation

Inputs

  • schema: nav-rel-test1.xsd
  • linkbase: nav-rel-test1-detached-calculation.xml (DTS Discovery starting point) (ID=V10)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A11'), '', 'http://www.xbrl.org/2003/arcrole/summation-item', 'descendant', xs:nonNegativeInteger(1))

    (against file V10)

Outputs

  • Result test: count($result) eq 3 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","calculationArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A111") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A112") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","A113")

V-10a Calculation relations with weights, default link

Documentation

Based on V-10 but default link is specified using an empty sequence instead of an empty string.

Inputs

  • schema: nav-rel-test1.xsd
  • linkbase: nav-rel-test1-detached-calculation.xml (DTS Discovery starting point) (ID=V10a)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A11'), (), 'http://www.xbrl.org/2003/arcrole/summation-item', 'descendant', xs:nonNegativeInteger(1))

    (against file V10a)

Outputs

  • Result test: count($result) eq 3 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","calculationArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A111") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A112") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","A113")

V-11 Calculation relations with weights, default link, default link name and arc name specified

Documentation

Based on V-10 but supplies values for the link name and arc name.

Inputs

  • schema: nav-rel-test1.xsd
  • linkbase: nav-rel-test1-detached-calculation.xml (DTS Discovery starting point) (ID=V11)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A11'), (), 'http://www.xbrl.org/2003/arcrole/summation-item', 'descendant', xs:nonNegativeInteger(1), QName('http://www.xbrl.org/2003/linkbase', 'calculationLink'), QName('http://www.xbrl.org/2003/linkbase', 'calculationArc') )

    (against file V11)

Outputs

  • Result test: count($result) eq 3 and (every $r in $result satisfies xfi:relationship-name($r) eq QName("http://www.xbrl.org/2003/linkbase","calculationArc")) and xfi:relationship-to-concept($result[1]) eq QName("http://abc.com/test","A111") and xfi:relationship-to-concept($result[2]) eq QName("http://abc.com/test","A112") and xfi:relationship-to-concept($result[3]) eq QName("http://abc.com/test","A113")

V-12 Calculation relations with link name that does not match any networks

Documentation

Based on V-11 but supplies non-standard value for the link name so that no concepts will be matched.

Inputs

  • schema: nav-rel-test1.xsd
  • linkbase: nav-rel-test1-detached-calculation.xml (DTS Discovery starting point) (ID=V12)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A11'), (), 'http://www.xbrl.org/2003/arcrole/summation-item', 'descendant', xs:nonNegativeInteger(1), QName('http://www.xbrl.org/2003/linkbase', 'linkThatDoesNotAppearInTaxonomy'), QName('http://www.xbrl.org/2003/linkbase', 'calculationArc') )

    (against file V12)

Outputs

  • Result test: empty($result)

V-13 Calculation relations with arc name that does not match any networks

Documentation

Based on V-11 but supplies non-standard value for the arc name so that no concepts will be matched.

Inputs

  • schema: nav-rel-test1.xsd
  • linkbase: nav-rel-test1-detached-calculation.xml (DTS Discovery starting point) (ID=V13)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A11'), (), 'http://www.xbrl.org/2003/arcrole/summation-item', 'descendant', xs:nonNegativeInteger(1), QName('http://www.xbrl.org/2003/linkbase', 'calculationLink'), QName('http://www.xbrl.org/2003/linkbase', 'arcThatDoesNotAppearInTaxonomy') )

    (against file V13)

Outputs

  • Result test: empty($result)

V-14 Invalid axis supplied

Documentation

Supplies an axis that isn't supported by the function.

Inputs

  • schema: nav-rel-test1.xsd
  • linkbase: nav-rel-test1-detached-calculation.xml (DTS Discovery starting point) (ID=V14)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A11'), (), 'http://www.xbrl.org/2003/arcrole/summation-item', 'ancestor-or-self', xs:nonNegativeInteger(0), QName('http://www.xbrl.org/2003/linkbase', 'calculationLink'), QName('http://www.xbrl.org/2003/linkbase', 'calculationArc') )

    (against file V14)

Outputs

  • Error code: xfie:InvalidConceptRelationParameters

V-15 Invalid axis and generation combination supplied

Documentation

Supplies an axis and generation that isn't supported by the function.

Inputs

  • schema: nav-rel-test1.xsd
  • linkbase: nav-rel-test1-detached-calculation.xml (DTS Discovery starting point) (ID=V15)
  • Function Call: xfi:concept-relationships( QName('http://abc.com/test','A11'), (), 'http://www.xbrl.org/2003/arcrole/summation-item', 'sibling', xs:nonNegativeInteger(2), QName('http://www.xbrl.org/2003/linkbase', 'calculationLink'), QName('http://www.xbrl.org/2003/linkbase', 'calculationArc') )

    (against file V15)

Outputs

  • Error code: xfie:InvalidConceptRelationParameters

Revisions

Name On Details
Herm Fischer 12-12-2008 at 00:00:00 Created the test case in original form for navigate-relationships.
Herm Fischer 28-10-2009 at 20:00:00 Adapted this test from original navigate-relationships test.
Herm Fischer 02-11-2009 at 12:00:00 Fixed typos.
Herm Fischer 08-03-2010 at 12:00:00 Adapted syntax for opaque relationship object and functions to access relationship results.
Herm Fischer 09-09-2010 at 00:00:00 Changed role URIs to strings for cast-less coding and to be similar to fn:QName's $paramURI, an xs:string.
Andy Harris 11-09-2010 at 12:00:00 Fixed typos.
Andy Harris 14-09-2010 at 12:00:00 Fixed issues raised by Okumura-san.
Peter Cowan 29-11-2012 at 17:43:00 Added a derivative of variation V-10 which uses an empty sequence instead of an empty string to specify the default link.
Richard Ashby 10-01-2014 at 15:00:00 Added variations for this function using optional parameters for link names and arc names. Added examples that do and don't match networks in the taxonomy.
Peter Cowan 31-01-2014 at 15:20:00 Added variations for invalid axis and generation combinations.